//
//  CLAudioWindow.m
//  chanlin
//
//  Created by Ryan on 15/6/21.
//  Copyright (c) 2015年 chanlin. All rights reserved.
//

#import "CLAudioWindow.h"
#import "UIView+Utils.h"
#import "CLDocViewController.h"
#import "CLPushAnimatedRight.h"

@implementation CLAudioWindow

- (instancetype)init{
    self=[super init];
    if(self){
        
    }
    return self;
}

- (void)openAudioWindowWith:(NSString *)title ItemId:(NSString *)itemId{
    self.backgroundColor=RGB(0xf8, 0xf8, 0xf8);
    
    self.itemId = [NSString new];
    self.itemId = itemId;
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(0, 0, GlobleWidth, 20);
    [button addTarget:self action:@selector(goBackArticle:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:button];
    
    UIImageView *playIcon = [[UIImageView alloc]initWithFrame:CGRectMake(11, 0, 6, 8)];
    [playIcon setImage:[UIImage imageNamed:@""]];
    playIcon.backgroundColor = [UIColor clearColor];
    [button addSubview:playIcon];
    
    UILabel *playLabel = [[UILabel alloc]initWithFrame:CGRectMake(playIcon.right+5, 0, 60, 20)];
    playLabel.backgroundColor = [UIColor clearColor];
    playLabel.text = @"当前播放：";
    playLabel.textAlignment = NSTextAlignmentLeft;
    playLabel.textColor = RGB(0xff, 0x30, 0x3b);
    playLabel.font = [UIFont systemFontOfSize:11.f];
    [button addSubview:playLabel];
    
    UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(playLabel.right, 0, GlobleWidth-playLabel.right, 20)];
    titleLabel.backgroundColor = [UIColor clearColor];
    titleLabel.text = title;
    titleLabel.textAlignment = NSTextAlignmentLeft;
    titleLabel.textColor = RGB(0xff, 0x30, 0x3b);
    titleLabel.font = [UIFont systemFontOfSize:11.f];
   [button addSubview:titleLabel];
    
}

-(void)goBackArticle:(UIButton *)button {
    CLDocViewController *doc=[CLDocViewController new];
    doc.itemId=self.itemId;
    [[CLPushAnimatedRight sharedInstance] pushController:doc];
}

@end
